﻿
@model Reap.AzureResource.Model.Models.Location
@{
	Layout = "~/Views/Shared/DefaultListHtml.cshtml";
	ViewBag.Title = "发送文件";
	ViewBag.ListUrl = "/Home";
	ViewBag.ListTitle = "文件列表";
}
@section HeadCss{
	<link href="~/Content/Css/uploadify.css" rel="stylesheet" />

}
@section HeadJs{

<script src="~/Content/Scripts/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="/Content/scripts/Validform_v5.3.2_min.js"></script>

	<script>
		$(function () {
			$("#form1").initValidform();
			//$("#FTypeID").val("");

		});
	</script>

}	

@{

	//var list = new List<string> { "http://10.1.1.50","http://10.1.1.50","http://10.1.0.38:8090","http://10.1.1.50","http://10.1.0.38:8090","http://10.1.0.38:8090","http://10.1.1.48","http://10.1.1.48","http://10.1.0.38:8090" };
	//int iSeed = 10;
	//Random ro = new Random(10);
	//long tick = DateTime.Now.Ticks;
	//Random ran = new Random(( int )(tick & 0xffffffffL) | ( int )(tick >> 32));
	//var n = ran.Next(0,8);
	var n = 0;
	var list = new List<string> { "http://10.1.1.50" };

} 
<form action="@ViewBag.ListUrl/SaveTask" name="form1" id="form1" method="POST">
	<!--内容-->
	<div class="content-tab-wrap">
		<div id="floatHead" class="content-tab">
			<div class="content-tab-ul-wrap">
				<ul>
					<li><a href="javascript:;" onclick=" tabs(this); " class="selected">@ViewBag.Title</a></li>
				</ul>
			</div>
		</div>
	</div> 
	<input type="hidden" name="fid" id="fid" value="" />
	<input type="hidden" name="FUrl" id="FUrl" value="@list[n]" />
	<div class="tab-content">
		<dl>
			<dt>网络环境</dt>
			<dd>
				<div class="rule-single-select">
					<select name="FTypeID" id="FTypeID" datatype="*" errormsg="请选择发送网络环境" sucmsg=" ">
						<option value="">请选择...</option>
						<option value="0">外网</option>
						<option value="1">内网</option>
					</select>
				</div>
			</dd>
		</dl>
		<dl>
			<dt>是否紧急文件</dt>
			<dd>
				<div class="rule-single-checkbox">
					<input id="FStatus" type="checkbox" name="FStatus" value="true" />
				</div>
				<span class="Validform_checktip">*不启用则排队发送</span>
			</dd>
		</dl>
		<dl>
			<dt>接受人</dt>
			<dd><input name="FUserName" type="text" value="" id="FUserName" class="input normal" datatype="*" sucmsg=" " /> <span class="Validform_checktip">*字母、下划线，不可修改</span></dd>
		</dl>
		<dl>
			<dt>接受人邮箱</dt>
			<dd><input name="Fmail" type="text" value="" id="Fmail" class="input normal" datatype="e" nullmsg="请设置邮箱" errormsg="邮箱格式不对" sucmsg=" " /> <span class="Validform_checktip">*</span></dd>
		</dl>
		<dl>
			<dt>上传文件</dt>
			<dd>
				<input id="resourceId" name="resourceId" value="0" type="hidden" />
				<span id="fileName"></span>
				<div id="queue"></div>
				<input id="filedata" name="filedata" type="file" multiple="true">
			</dd>
		</dl>

	</div>
	<!--/内容-->
	<!--工具栏-->
	<div class="page-footer">
		<div class="btn-list">
			<input type="submit" name="btnSubmit" value="提交保存" id="btnSubmit" class="btn" />
			<input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick=" javascript:history.back(-1); " />
		</div>
		<div class="clear"></div>
	</div>
	<!--/工具栏-->
</form>
			
<script type="text/javascript">

	$(window).load(function(){
		
		$('#filedata').uploadify({
		
			width: 96,                          // 按钮的宽度
			height: 23,                         // 按钮的高度
			buttonText: "选择上传文件",                 // 按钮上的文字
			buttonCursor: 'hand',                // 按钮的鼠标图标
			'swf': '/content/swf/uploadify.swf',
			'uploader': '@list[n]/api/upload'
		
            , onUploadSuccess: function (file, data, response) {
            	$("#fileName").html('<a href=@list[n]/api/get/?id=' + data + ' target=_blank>' + file.name + '</a> <a href="javascript:;" style="color:#ff0000;font-size:16px; font-weight:bold;"  onclick=del();>×</span>');
            	$("#resourceId").val(data);
			} , onQueueComplete: function (queueData) {
            	//全部执行完毕
            	$("#filedata-queue").html("");
            	$('#fileUploader').css({ 'visibility': 'hidden' });
			}
		

		});
	});
	function del() {
		$("#fileName").html("");
		$('#fileUploader').css({ 'visibility': 'visible' });
	
		$("#resourceId").val("0");
	}
</script>

